<extend name="Include:Layout"/>
<block name="title">自定义介绍</block>
<block name="style">

</block>

<block name="main">
	<div class="weui_tab">
		<div class="weui_navbar">
			<div class="weui_navbar_item weui_bar_item_on">自定义支付</div>
		</div>
		<div class="weui_tab_bd container" id="container" style="padding-top:44px;">
		    <div class="weui_cells_title">订单信息</div>
			<div class="weui_cells weui_cells_form">
			  <div class="weui_cell">
			    <div class="weui_cell_bd weui_cell_primary">
			      <textarea class="weui_textarea" name="info" id="info" placeholder="请输入订单信息" rows="3"></textarea>
			    </div>
			  </div>
			</div>
			<div class="weui_cells weui_cells_form" style="margin-top:10px;">
				<div class="weui_cell">
			     <div class="weui_cell_hd"><label class="weui_label">金额</label></div>
			     <div class="weui_cell_bd weui_cell_primary">
			       <input class="weui_input" type="number" name="total" placeholder="金额">
			     </div>
			    </div>
			</div>
			<div style="padding:15px;">
				<input type="hidden" name="uid" value="{$_SESSION['_loginUser_home']['uid']}"/>
				<button class="weui_btn weui_btn_primary btncheckorder">提交</button>
			</div>
		</div>
	</div>
</block>

<block name="script">
<script>
$(".btncheckorder").click(function(){
	var thisBtn = $(this);
	if(thisBtn.attr('disabled') == 'disabled') {
        return;
	}
	var total = $("input[name=total]").val();
	if(total == ''){
		$.toast("请输入金额","text");
		return false;
	}
	var data = {
		'info' : $("#info").val(),
		'total' : total,
		'uid' :  $("input[name=uid]").val(),
	};
	thisBtn.attr('disabled', 'disabled');
	$.post('/home/freepay/savefreepay',data,function(ret){
		thisBtn.removeAttr('disabled');
		if(ret.status){
			location.href='/weixin/pay/index/id/'+ret.data+'.html';
		}else{
			$.toast("提交失败","text");
		}
	})
})
</script>
</block>